home *** CD-ROM | disk | FTP | other *** search
/ The PC-SIG Library 9 / The PC-SIG Library on CD ROM - Ninth Edition.iso / 1601_700 / DISK1665 / DISK1665.ZIP / LANGTPAS.KED < prev   
Text File  |  1980-01-01  |  33KB  |  689 lines

  1. .Notice - Last Update:1988/11/19 17:30
  2. Importance Notice: The information contained in this option are for quick
  3.                    reference only. The accuracy of it should be based on your
  4.                    language reference manual.
  5. Set Up By        : Kuang H. Tseng
  6. Language         : TURBO PASCAL(R) 5.0 by BORLAND INTERNATIONAL INC.
  7. . 1.   Language Elements
  8.     Character Set
  9.          A to Z,a to z, _(underscore),0 to 9,
  10.          + - * / = < > [ ] . , ( ) : ; ^ @ { } $ # 
  11.     Data Types - (refer to separate key line for more)
  12.     Identifiers - (refer to separate key line for more)
  13.     Constants - (refer to separate key line for more)
  14.     Reserved Words (refer to separate key line for more)
  15.     Operators and the precedence - (refer to separate key line for more)
  16.     Delimiters - blank,end of line mark,a comment
  17.     Program Line - maximum length 126
  18.     Comments - '{' and '}' or '(*' and '*)'
  19.     Units - (refer to separate key line for more)
  20.     Statements - (refer to separate key line for more)
  21.     Procedures - (refer to separate key line for more)
  22.     Functions - (refer to separate key line for more)
  23.     File Types
  24.     Compiler Directives - (refer to separate key line for more)
  25. . 2.   Data Types
  26.     integer - 2 bytes, signed -32768 to 32767
  27.     shortint - 1 byte, signed -128 to 127
  28.     longint - 4 bytes, signed -2147483648 to 2147483647
  29.     byte - 1 byte, unsigned 0 to 255, subrange of type Integer
  30.     word - 2 bytes, unsigned 0 to 65535
  31.     real -  6 bytes, 2.9E-39 to 1.7E+38 with mantissa 11-12 digits
  32.     single -  4 bytes, 1.5E-45 to 3.4E+38 with mantissa 7-8 digits
  33.     double -  8 bytes, 5.0E-324 to 1.7E+308 with mantissa 15-16 digits
  34.     extended -  10 bytes, 3.4E-4932 to 1.1E+4932 with mantissa 19-20 digits
  35.     comp -  8 bytes, -2**63+1 to 2**63-1 with mantissa 19-20 digits
  36.     boolean -  1 byte, True or False
  37.     char - 1 byte, one character in ASCII character set
  38.     string - the defined length plus one byte
  39.     array - consist of a fixed number of components which are all same type
  40.     pointer - a varable containing the memory address of another variable
  41.     record - consist of a fixed number of fields which may be different types
  42.     set - a collection of related objects
  43. . 3.1  Identifiers 
  44.     - denote labels, constants, types, variables, procedure, function, units,
  45.       programs, and fields in records
  46.     - consists of a letter or underscore followed by letters,digits,underscords
  47.     - any length but only 63 characters are significant
  48.     - not case sensitive
  49.     - unit identifier may need to qualify the same identifiers
  50. . 3.2  Constants
  51.     - decimal integer : range -32768 to 32767
  52.     - hexadecimal integer :preceded by a dollar sign $, range $0000 to $FFFF
  53.     - string : sequence of characters enclosed in single quotes
  54.     - ASCII : preceded by symbol #
  55.     - control character : preceded by symbol ^
  56. . 3.3  Reserved Words
  57.     absolute       and            array          
  58.     begin          
  59.     case           const
  60.     div            do             downto
  61.     else           end            external
  62.     file           forward        function
  63.     goto
  64.     if             implementation in             inline         interface
  65.     interrupt
  66.     label
  67.     mod
  68.     nil            not
  69.     of             or
  70.     packed         procedure      program
  71.     record         repeat
  72.     set            shl            shr            string
  73.     then           to             type
  74.     unit           until          uses
  75.     var
  76.     while          with
  77.     xor          
  78. . 4.   Operators and the Precedence
  79.     Unary @ not
  80.     Arithmetic *,/,div,mod,and shl,shr,+,-,or,xor
  81.     Relational =,<>,<,>,<=,=>,in
  82.     Assignment :=
  83. . 5.1  Units
  84.     - Unit is a library or collection of constants,data types,variables,
  85.       procedures and functions. It is used to split large program into modulars.
  86.     - Source code is written as .PAS file and can be precompiled into .TPU file
  87.     - The structure of unit is as following:
  88.          UNIT <identification>
  89.          INTERFACE
  90.          USES <list of other units>;      {optional}
  91.            { public declarations }
  92.          IMPLEMENTATION
  93.          USES <list of other units>;      {optional}
  94.            { private declarations }
  95.            { implementation of procedures and functions }
  96.          BEGIB
  97.            { initialization code }
  98.          END.
  99.     - 8 standard precompiled units provided standard procedures and functions in
  100.          System - run-time library
  101.          Overlay - overlay manager
  102.          Graph - support CGA,EGA,VGA,HERC,3270PC,MCGA,AT&T6300 graphics
  103.          Dos - date,time,directory and program execution 
  104.          Crt - display,keyboard,color,window and sound
  105.          Printer - printer access
  106.          Turbo3 - provide compatibility with Turbo Pascal 3.0
  107.          Graph3 - Turbo Pascal 3.0 Turtlegraphics
  108. . 5.2  List of Statements
  109.     assignment ,i.e., A := 10;
  110.     CASE...OF...ELSE...END
  111.     FOR...TO/DOWNTO...DO
  112.     GOTO
  113.     IF...THEN..ELSE
  114.     PROCEDURE ,i.e., readfile(key,rcd);
  115.     REPEAT...UNTIL
  116.     WHILE varname DO BEGIN ... END
  117.     WITH...DO
  118. . 5.3  List of Standard Procedures & Functions() by Category
  119. - I/O for general
  120.          Assign    ChDir     Close     Erase     GetDir    MkDir     Rename
  121.          Reset     Rewrite   RmDir     Eof()     IOResult()
  122. - I/O for Text Files
  123.          Append    Flush     Read      Readln    SetTextBuf          Write
  124.          Writeln   Eoln()    SeekEof() SeekEoln()
  125. - I/O for Untyped Files
  126.          BlockRead BlockWrite          FilePos() FileSize() Seek     Truncate
  127. - Flow Control
  128.          Exit      Halt      RunError
  129. - Dynamic Allocation
  130.          Dispose   FreeMem   Mark      New       Release   MaxAvail()
  131.          MemAvail()
  132. - Transfer
  133.          Chr()     FillChar  Move      Ord()     Round()   Swap()    
  134.          UpCase()
  135. - Arithmetic
  136.          Abs()     ArcTan()  Cos()     Exp()     Frac()    Int()
  137.          Ln()      Pi()      Sin()     Sqr()     Sqrt()
  138. - Ordinal
  139.          Dec       Inc       Odd()     Pred()    Succ()
  140. - String
  141.          Delete    Insert    Str       Val       Concat()  Copy()
  142.          Length()  Pos()
  143. - Pointer & Address
  144.          Addr()    CSeg()    DSeg()    Ofs()     Ptr()     Seg()
  145.          SPtr()    SSeg()
  146. - Interrupt Support
  147.          GetIntVec Intr      MsDos     SetIntVec
  148. - Date and Time
  149.          GetDate   GetFTime  GetTime   PackTime  SetDate   SetFTime
  150.          SetTime   UnpackTime
  151. - Disk Status
  152.          DiskFree()          DiskSize()
  153. - File-Handling
  154.          FindFirst FindNext  GetFAttr  SetFAttr  FSplit    FExpand()
  155.          FSearch()
  156. - Display-Handling
  157.          AssignCrt ClrEol    ClrScr    DelLine   GotoXY    HighVideo
  158.          InsLine   LowVideo  NormVideo TextBackground      TextColor
  159.          TextMode  Window    WhereX()  WhereY()
  160. - Keyboard
  161.          KeyPressed()        ReadKey()
  162. - Graph
  163.          Arc       Bar       Bar3D     Circle    ClearDevice         CloseGraph
  164.          DetectGraph         DrawPoly  Ellipse   FillEllipse         FillPoly
  165.          FloodFill GetArcCoords        GetAspectRatio      GetDefaultPalette
  166.          GetFillPattern      GetFillSettings     GetImage  GetLineSettings
  167.          GetModeRange        GetPalette          GetTextSettings
  168.          GetViewSettings     GraphDefaults       InitGraph Line      LineRel
  169.          LineTo    MoveRel   MoveTo    OutText   OutTextXY PieSlice  PutImage
  170.          PutPixel  Rectangle RestoreCrtMode      Sector    SetActivePage
  171.          SetAllPalette       SetAspectRatio      SetBkColor          SetColor
  172.          SetFillPattern      SetFillStyle        SetGraphBufSize
  173.          SetGraphMode        SetLineStyle        SetPalette
  174.          SetRGBPalette       SetTextJustify      SetTextStyle
  175.          SetUserCharSize     SetViewPort         SetVisualPage
  176.          SetWriteMode        GetBkColor()        GetColor()
  177.          GetDriverName()     GetGraphMode()      GetMaxColor()
  178.          GetMaxMode()        GetMaxX() GetMaxY() GetModeName()
  179.          GetPaletteSize()    GetPixel()          GetX()    GetY()
  180.          GraphErrorMsg()     GraphResult()       ImageSize()
  181.          InstallUserDriver() RegisterBGIdriver() RegisterBGIfont()
  182.          TextHeight()        TextWidth()
  183. - Speaker
  184.          Sound
  185. - Process-Handling
  186.          Execute   Keep      SwapVectors         DosExitCode()
  187. - Environment-Handling
  188.          EnvCount()          EnvStr()            GetEnv()
  189. - Miscellaneous
  190.          Randomize Hi()      Lo()      ParamCount()        ParamStr()
  191.          Random()  SizeOf()
  192.          DosVersion()        GetCBreak()         SetCBreak()
  193.          GetVerify()         SetVerify()
  194.          Delay
  195. . 5.4  List of Procedures by Name order
  196.     Append(var f:text) - appends existing file
  197.     Arc(x,y:integer;angle1,angle2,,radius:word) - draw a circle arc
  198.     Assign(var f;name:string) - assigns file name to file variable
  199.     AssignCrt(var f:text) - associates a text file with the CRT
  200.     Bar(x1,y1,x2,y2:integer) - draws a bar
  201.     Bar3D(x1,y1,x2,y2:integer;Depth:Word;Top:Bollean) - draws 3-D bar
  202.     BlockRead(var f:file;var buf;count:word [;var result:Word]) - reads block
  203.     BlockWrite(var f:file;var buf;count:word [;var result:Word]) - write block
  204.     ChDir(path:string) - changes the current directory
  205.     Circle(x,y:integer;radius:integer) - draws circle
  206.     ClearDevice - clears graphics screen
  207.     ClearViewPort - clears current viewport
  208.     Close(var f) - closes an open file
  209.     CloseGraph - closes graphics system
  210.     ClrEol - clears cursor to end of line
  211.     ClrScr - clears the screen
  212.     Dec(var x [;n:longint]) - decrements a variable
  213.     Delay(ms:integer) - delays a specified number of milliseconds
  214.     Delete(var s:string;index:integer;count:integer) - deletes a substring
  215.     DelLine - deletes the line
  216.     DetectGraph(var GraphDriver, GraphMode:integer) - get graphic mode & driver
  217.     Dispose(var p:pointer) - disposes a dynamically allocated variable
  218.     DrawPoly(NumPoints:word; var PolyPoints) - draws a polygon
  219.     Ellipse(X,Y:integer;StAngle,EndAngle:word;XRadius,YRadius:word) - draws arc
  220.     Erase(var f) - erase a file
  221.     Exec(path, CmdLine:string) - executes a program
  222.     Exit - exits from current block
  223.     FillChar(var x; count:word; ch:value) - fills a specified value to memory
  224.     FillEllipseX,Y:integer;XRadius,YRadius:word) - draws an ellipse
  225.     FillPoly(Numpoints:word;var PolyPoints) - draws & fills a polygon
  226.     FindFirst(Path:string;Attr:word; var S:SearchRec) - find first dir match
  227.     FindNext(var S:SearchRec) - find the next entry that matches
  228.     FloodFill(X,Y:integer;Border:word) - fills a enclosed area with pattern
  229.     Flush(var f:text) - flushes the output buffer
  230.     Freemem(var p:pointer;size:word) - disposes a sized dynamic variable
  231.     FSplit(Path:PathStr;var Dir:DirStr;var Name:NameStr;Var Ext:ExtStr) - split
  232.           file name into strings of pathname,drive,name,extension
  233.     GetArcCoords(var ArcCoords:ArcCoordType) - get coordinates of Arc 
  234.     GetAspectRatio(var Xasp,Yasp:word) - get aspect ratio of graphics screen
  235.     GetCBreak(var Break:Boolean) - get state of Ctrl-Break checking
  236.     GetDate(var Year,Month,Day,DayofWeek:word) - get system date
  237.     GetDir(d:byte; var s:string) - get current directory of specified drive
  238.     GetFAttr(var f;var Attr:word) - get attributes of a file
  239.     GetFillPattern(var FillPattern:FillPatternType) - get last fill pattern
  240.     GetFillSettings(var FillInfo:FillPatternType) - get last fill pattern,color
  241.     GetFTime(var f;var Time:longint) - get date,time of a file last updated
  242.     GetImage(x1,y1,x2,y2:integer; var BitMap) - save bit image of a region
  243.     GetIntVec(IntNo:byte;var Vector:pointer) - get address of a interrupt vector
  244.     GetLineSettings(var LineInfo:LineSettingsType) - get line style,pattern
  245.     GetMem(var p:pointer;size:word) - create new dynamic variable in size
  246.     GetModeRange(GraphDriver:integer;var LoMode,HiMode:integer) - get the 
  247.                 lowest and highest valid graphics mode for a given driver
  248.     GetPalette(var Palette:PaletteType) - get current palette and its size
  249.     GetTextSettings(var TextInfo:TextSettingsType) - get font,size & direction
  250.     GetTime(var Hour,Minute,Second,Sec100:word) - get system time
  251.     GetVerify(var Verify:Boolean) - get state of verify flag of DOS disk write
  252.     GetViewSettings(var ViewPort:ViewPortType) - get viewport & clip settings
  253.     GotoXY(X,Y:byte) - move cursor to X column, Y row
  254.     GraphDefault - reset graphics system of viewport,palette,colors,line,etc
  255.     Halt[(exitcode:word)] - halt the execution and return to DOS
  256.     HighVideo - turn intensity on 
  257.     Inc(var x [;n:longint] - increment a variable
  258.     InitGraph(var GraphDriver:integer;var GraphMode:integer;DriverPath:string) -
  259.              select graphics mode and initialize graphics system
  260.     Insert(source:string;var s:string;index:integer) - inset a substring
  261.     InsLine - insert a line
  262.     Intr(intNo:byte;var Regs:Registers) - do software intrrupt
  263.     Keep(ExitCode:word) - terminate but stay resident in memory
  264.     Line(x1,y1,x2,y2:integer) - draw a line
  265.     LineRel(Dx,Dy:integer) - draw a line to a point relative to current pointer
  266.     LineTo(X,Y:integer) - draw a line from current pointer
  267.     LowVideo - turn off intensity
  268.     Mark(var p:pointer) - store the pointer variable for RELEASE procedure
  269.     MkDir(path:string) - create a subdirectory
  270.     Move(var source,dest;count:word) - copy contiguous bytes
  271.     MoveRel(Dx,Dy:integer) - move the current pointer a relative distance
  272.     MoveTo(X,Y:integer) - move the current pointer to new position
  273.     MsDos(var Regs:Registers) - do a DOS function interrupt
  274.     New(var p:pointer) - dynamic allocate a variable and set pointer
  275.     NormVideo - restore the text attribute to program startup state
  276.     NoSound - turn off speaker
  277.     OutText(TextString:string) - output text string at current pointer
  278.     OutTextXY(X,Y:integer;TextString:string) - output text at XY position
  279.     OvrClearBuf - clear the overlay buffer
  280.     OvrInit(FileName:string) - initialize the overlay manager and overlay file
  281.     OvrInitEMS - load the overlay file into EMS
  282.     OvrSetBuf(BufSize:longint) - set the size of the overlay buffer
  283.     PackTime(var DT:DateTime; var Time:longint) - pack DateTime record to 4 byte
  284.     PieSlice(x,y:integer;StAngle,EndAngle,Radius:word) - draw and file pie slice
  285.     PutImage(x,y:integer;var BitMap;BitBit:word) - put a bit image onto screen
  286.     PutPixel(x,y:integer;Pixel:word) - plot a pixel
  287.     Randomize - initialize a random value
  288.     Read([var f:text;] v1 [,v2,...,vn]) - read data from text file to variables
  289.     Read(f,v1 [,v2,...,vn]) - read a file component into a variable
  290.     Readln([var f:text;] v1 [,v2,...,vn]) - read text data and skip to next line
  291.     Rectangle(x1,y1,x2,y2:integer) - draw rectangle
  292.     Release(var p:pointer) - dispose all dynamically allocated variables
  293.     Rename(var f;newname:string) - rename a file
  294.     Reset(var f [:file; recsize:word]) - open an existing file
  295.     RestoreCrtMode - restore screen mode to prior state
  296.     Rewrite(var f [:file;recsize:word]) - create and open a new file
  297.     RmDir(path:string) - remove an empty subdirectory
  298.     RunError([ErrorCode:word]) - stop the program and generate a run-time error
  299.     Sector(x,y:integer;StAngle,EndAngle,XRadius,YRadius:word) - draw an sector
  300.     Seek(var f; n:longint) - move the current file postion
  301.     SetActivePage(Page:word) - set the active page for graphics
  302.     SetAllPalette(var Palette) - change all palette colors
  303.     SetAspectRatio(Xasp,Yasp:word) - change the aspect ratio
  304.     SetBkColor(Color:word) - set background color
  305.     SetCBreak(Break:Boolean) - set Ctrl-Break checking on
  306.     SetColor(Color:word) - set the current drawing color
  307.     SetDate(Year,Month,Day:word) - set system date
  308.     SetFAttr(var f;Attr:word) - set the attributes of a file
  309.     SetFillPattern(Pattern:FillPatternType;Color:word) - select a fill pattern
  310.     SetFillStyle(Pattern:word;Color:word) - set fill pattern and color
  311.     SetFtime(var f;Time:longint) - reset the date and time of a file
  312.     SetGraphBufSize(BufSize:word) - set the buffer size for scan and flood fill
  313.     SetGraphMode(Mode:integer) - set system to graphics mode
  314.     SetIntVec(IntNo:byte;Vector:pointer) - set a interrupt vector to new address
  315.     SetLineStyle(LineStyle:word;Pattern:word;Thickness:word) - set line style
  316.     SetPalette(ColorNum:word;Color:shortint) - set palette color
  317.     SetRGBPalette(ColorNum,RedValue,GreenValue,BlueValue:integer) - modify
  318.                  palette entries for IBM-8514 and VGA drivers
  319.     SetTextBuf(var f:text;var buf [;size:word]) - set an I/O buffer to text file
  320.     SetTextJustify(Horiz,Vert:word) - set text justification values
  321.     SetTextStyle(Font:word;Direction:word;CharSize:word) - set text style
  322.     SetTime(Hour,Minute,Second,Sec100:word) - set system time
  323.     SetUserCharSize(MultX,DivX,MultY,DivY:word) - set character size
  324.     SetVerify(Verify:Boolean) - set DOS verify flag
  325.     SetViewPort(x1,y1,x2,y2:integer;Clip:Boolean) - set output viewport
  326.     SetVisualPage(Page:word) - set visual graphics page number
  327.     SetWriteMode(WriteMode:integer) - set the writing mode for line drawing
  328.     Sound(Hz:word) - sound the speaker
  329.     Str(x [:width [:decimals]]; var s:string) - convert numeric to string
  330.     SwapVectors - swap the interrupt vector
  331.     TextBackground(color:byte) - select background color
  332.     TextColor(color:byte) - select foreground character color
  333.     TextMode(Mode:word) - select text mode
  334.     Truncate(var f) - truncate file at current file position
  335.     UnpackTime(Time:longint;var DT:DateTime) - unpack date-and-time record
  336.     Val(s:string,var v;var code:integer) - convert string to numeric format
  337.     Window(x1,y1,x2,y2:byte) - defines a text window
  338.     Write([var f:text;] v1 [,v2,...,vn]) - write values to a text file
  339.     Write(f, v1 [,v2,...,vn]) - write a variable to a file
  340.     Writeln([var f:text;] v1 [,v2,...,vn]) - write text file and CR/LF
  341. . 5.5  List of Functions by Name
  342.     Abs(x):same type - get absolute value
  343.     Addr(x):pointer - get address of
  344.     ArcTan(x:real):real - get arctangent
  345.     Chr(x:byte):char - get character
  346.     Concat(string1,string2 [,stringN]:string):string - concatenate strings
  347.     Copy(s:string,index:integer,count:integer):string - get a substring
  348.     Cos(x:real):real - get cosine
  349.     CSeg:word - get CS register value
  350.     DiskFree(Drive:word):longint - get number of free bytes in a drive
  351.     DiskSize(Drive:word):longint - get total size in bytes in a drive
  352.     DosExitCode:word - get exit code of a subprocess
  353.     DosVersion:word - get DOS version number
  354.     DSeg::word - get DS register value
  355.     EnvCount:integer - get number of strings in DOS environment
  356.     EnvStr(Index:integer):string - get a specified environment string
  357.     Eof[(var f:text)]:Boolean - get the status of EOF condition in a text file
  358.     Eof(var f):Boolean - get the status of EOF condition in a file
  359.     Eoln[(var f:text)]:Boolean - get the status of EOL of a file
  360.     Exp(x:real):real - get the exponential of a value
  361.     FExpand(Path:PathStr):PathStr - expand a file name to a file specification
  362.     FilePos(var f):longint - get the file position of a file
  363.     FileSize(var f):longint - get the file size
  364.     Frac(x:real):real - get the fractional part of a real value
  365.     Fsearch(Path:PathStr;DirList:string):PathStr - search a file in a given PATH
  366.     GetBkColor:word - get the index value of the current background color
  367.     GetColor:word - get the color value
  368.     GetDefaultPalette(var Pal:PaletteType):PaletteType - get palette definition
  369.     GetDriveName:string - get the name of the current driver
  370.     GetEnv(EnvVar:string):string - get the value of a specified environment var.
  371.     GetGraphMode:integer - get the current graphics mode
  372.     GetMaxColor:word - get the highest color value for SetColor procedure
  373.     GetMaxMode:word - get the maximum mode number for the current driver
  374.     GetMaxY:integer - get the x resolution of the current graphics driver & mode
  375.     GetMaxY:integer - get the y resolution of the current graphics driver & mode
  376.     GetModeName(ModeNumber:word):string - get the name of the graphics mode
  377.     GetPaletteSize:word - get the size of the paletter color entries
  378.     GetPixel(X.Y:integer):word - get the pixel value
  379.     GetX:integer - get the X coordinate of the current position
  380.     GetY:integer - get the Y coordinate of the current position
  381.     GraphErrorMsg(ErrorCode:integer):string - get the string of error message
  382.     GraphResult:integer - get the error code
  383.     Hi(x):byte - get the high-order byte
  384.     ImageSize(x1,y1,x2.y2:integer):word - get the number of bytes required to
  385.              store a rectangular region of the screen
  386.     InstallUserDriver(Name:string;AutoDetectPtr:pointer):word - install driver
  387.     InstallUserFont(FontFileName:string):integer - install a new font to BGI
  388.     Int(x:real):real - get integer part of real
  389.     IOresult:word - get integer status of last I/O operation
  390.     KeyPressed:Boolean - check if key has been pressed
  391.     Length(s:string):integer - get length of a string
  392.     Ln(x:real):real - get natural logarithm
  393.     Lo(x):byte - get low-order byte
  394.     MaxAvail:longint - get the largest available contiguous free block of memory
  395.     MemAvail:longint - get the sum of all available free memory in heap
  396.     Odd(x:longint):Boolean - check if x is an odd number
  397.     Ofs(x):word - get the offset address
  398.     Ord(x):longint - get the ordinal number
  399.     OvrGetBuf:longint - get the current size of the overlay buffer
  400.     ParamCount:word - get the number of parameters passed to the program
  401.     ParamStr(index):string - get the string of specified command line parameter
  402.     Pi:real - get the value of Pi
  403.     Pos(substr,s:string):byte - get the position of a substring
  404.     Pred(x):same type as x - get the predecessor of the x
  405.     Ptr(seg,ofs:word):pointer - get the pointer value
  406.     Random[(range:word)]:real/word - get a random number
  407.     ReadKey:char - read a character
  408.     RegisterBGIdriver(driver:pointer):integer - load a driver file and record it
  409.     RegisterBGIfont(font:pointer):integer - load a BGI font and record it
  410.     Round(x:real)::longint - round a real number to an integer
  411.     SeekEof[(var f:text)]:Boolean - get the EOF status of a text file
  412.     SeekEoln[(var f:text)]:Boolean - get the EOL status of a text file
  413.     Seg(x):word - get the segment address
  414.     Sin(x:real):real - get the sine of x
  415.     SizeOf(x):word - get the number of bytes used by x
  416.     SPtr:word - get the value of SP register
  417.     Sqr(x):same type as x - get square of x
  418.     Sqrt((x:real):real - get square root
  419.     Sseg:word - get the value of SS register
  420.     Succ(x):same type as x - get the successor of x
  421.     Swap(x):same type as x - swap the high-order byte with low-order byte
  422.     TextHeight(TextString:string):word - get the height of a string in pixels
  423.     TextWidth(TextString:string):word - get the width of a string in pixels
  424.     Trunc(x:real):longint - truncate a real value to integer
  425.     UpCase(ch:char):char - convert a character from lower case to upper case
  426.     WhereX:byte - get X-coordinate of current cursor position
  427.     WhereY:byte - get Y-coordinate of current cursor position
  428. . 6.   Program Structure
  429.     Program Heading 
  430.          - start with key word 'PROGRAM' 
  431.          - followed by program name and a semicolon(;)
  432.          - example : PROGRAM myprogram;
  433.     Declaration Part
  434.          - Label declaration part 
  435.               -- head with word 'LABEL' followed by a list of label identifiers
  436.                  separated by commas and terminated by semi-colon
  437.               -- example :LABEL EXIT,LOOP1;
  438.          - Constant definition part
  439.               -- head with word 'CONST' followed by a list of constant
  440.                  assignments separated by semi-colon
  441.               -- each assignment consists of an identifier followed by an equal
  442.                  sign and a constant
  443.               -- example : CONSTANT MAX_ROW = 25;
  444.          - type definition part
  445.               -- head with word 'TYPE' followed by a list of type assignment 
  446.                  separated by semi-colon
  447.               -- each assignment consists of an identifier followed by an equal
  448.                  sign and a type
  449.               -- example : TYPE DAY = (MON,TUE,WED,THUR,FRI,SAT,SUN);
  450.          - variabel decalration part
  451.               -- head with word 'VAR' followed by a list of identifiers 
  452.                  separated by comma, each followed by a colon and a type
  453.               -- the scope of this variable is the block in which it is defined
  454.               -- example : VAR X1,Y1,X2,Y2:INTEGER;
  455.          - procedure declaration part
  456.               -- consist of procedure heading and a block which consist of a
  457.                  declaration part and a statement part
  458.               -- procedure heading headed with word 'PROCEDURE' followed by an 
  459.                  identifier (procedure name) followed by a formal parameter list
  460.               -- example : PROCEDURE SWAP (VAR X,Y:INTEGER);
  461.          - function declaration part
  462.               -- same as procedure declaration part, except headed with word
  463.                  'FUNCTION' and the heading must defined the type of the
  464.                  function return. The return is defined by adding a colon
  465.                  and a type
  466.               -- example : FUNCTION FACTOR(X:INTEGER):INTEGER;
  467.     Statement Part
  468.          - start with key word 'BEGIN' and terminate with key word 'END' and '.'
  469. . 7.1  Sample of Main Program
  470. program Sample1;
  471. begin
  472.     writeln('Welcome to TURBO Pascal programming with kEDITOR');
  473. end.
  474. . 7.2  Sample of Main Program calling a Sub-program
  475. program Sample2;
  476.    var i:integer;
  477.    procedure subpgm1(var i:integer);
  478.       begin
  479.          i := 1;
  480.       end;
  481. begin
  482.     subpgm1(i);
  483.     writeln('The value of I is :',i);
  484. end.
  485. . 7.3  Sample of Main Program calling a Function
  486. program sample3;
  487. type string80 = STRING[80];
  488.    function UpString (Strg : String80 ) : String80;
  489.    var i : integer;
  490.    begin
  491.        for i := 1 to length(strg) do
  492.            strg[i] := UpCase(strg[i]);
  493.        UpString := strg;
  494.    end;
  495. begin
  496.     writeln(UpString('Hello the world'));
  497. end.
  498. . 7.4  Sample of WHILE...DO statement
  499. while (not EOF(input_file) do
  500.      begin
  501.            ...
  502.      end;      
  503. . 7.5  Sample of REPEAT...UNTIL statement
  504. if (IOresult = 0) then
  505.      begin
  506.            file_exit=TRUE;
  507.            close(in_file);
  508.       end
  509. else
  510.      file_exit=FALSE;
  511. . 7.6  Sample of FOR...DO statement
  512. for i := 1 to 5 do
  513.      for j := 1 to 10 do
  514.        begin
  515.            arrayX [i,j] = i + j;
  516.            arrayY [i,j] = i - j;
  517.        end;
  518. . 7.7  Sample of IF...THEN...ELSE statement
  519. if x < 0 then
  520.      writeln('x is negative')
  521. else if x = 0 then
  522.         writeln('x is zero')
  523. else writeln('x is positive');
  524. . 7.8  Sample of CASE...OF statement
  525. case choice of
  526.      'A','a' : writeln('Option A selected');
  527.      'B','b' : writeln('Option B selected');
  528.      'C','c' : writeln('Option C selected');
  529. end; {case}
  530. . 7.9  Sample of GOTO statement
  531. program Sample9;
  532. label loop, exit;
  533. const ESC = #27;
  534. var   choice : char;
  535. if (choice = ESC) then
  536.      goto exit;
  537. else goto loop;
  538. exit: writeln('End of Program');
  539. end.
  540. . 7.10 Sample of Menu Displaying and Choice Selecting
  541. program Sample10;
  542. uses crt;
  543.    label quit;
  544.    Const
  545.          ESC = #27;
  546.    var   char1, attr : char;
  547. begin
  548.     clrscr;
  549.     writeln;
  550.     writeln('A : Add a book to booklist');
  551.     writeln('B : Update information to booklist');
  552.     writeln('C : Delete a book from the booklist');
  553.     writeln('D : Quit');
  554.     writeln;
  555.     write('Enter your choice ? ');
  556.     attr := ReadKey;
  557.     if (attr = ESC) then goto Quit;
  558.   Quit: writeln('End of Program');
  559. end.
  560. . 7.11 Sample of Sequential File Input (Read)
  561. program sample11;
  562. uses crt;
  563.    type book_type = record
  564.        title    : string[20];
  565.        cost     : integer;
  566.     end;
  567.     var book_data : book_type;
  568.         book_file : file of book_type;
  569. begin
  570.    clrscr;
  571.    assign(book_file,'BOOKLIST.DAT');
  572.    reset(book_file);
  573.    while not eof(book_file) do
  574.      begin
  575.        read(book_file,book_data);
  576.        writeln('Book Title : ',book_data.title);
  577.        writeln('Book Cost : ',book_data.cost);
  578.      end;
  579.     close(book_file);
  580. end.
  581. . 7.12 Sample of Sequential File Output (Write)
  582. program sample12;
  583. uses crt;
  584.    type book_type = record
  585.        title    : string[20];
  586.        cost     : integer;
  587.     end;
  588.     var book_data : book_type;
  589.         book_file : file of book_type;
  590. begin
  591.    assign(book_file,'BOOKLIST.DAT');
  592.    rewrite(book_file);
  593.    repeat
  594.        clrscr;
  595.        writeln('Book Title : ');
  596.        readln(book_data.title);
  597.        writeln('Book Cost : ');
  598.        readln(book_data.cost);
  599.     until (book_data.title='');
  600.     close(book_file);
  601. end.
  602. . 7.13 Sample of Text File Input (Write)
  603. program sample13;
  604. uses crt;
  605.    const ENTER = #13;
  606.          LF    = #10;
  607.    var   text_file : text;
  608.          achar     : char;
  609. begin
  610.    writeln('Enter text line up to 80 characters long. Ctrl-Z to end');
  611.    assign(text_file,'PASCAL.SRC');
  612.    rewrite(text_file);
  613.    repeat
  614.        achar := ReadKey;
  615.        if (achar = ^M) then
  616.          writeln;
  617.        if (achar <> ^Z) then
  618.            write(achar);
  619.        write(text_file,achar);
  620.    until (achar = ^Z);
  621.    close(text_file);
  622. end.
  623. . 7.14 Sample of Text File Output (Read)
  624. program sample14;
  625.    const ENTER = #13;
  626.          LF    = #10;
  627.    var   text_file : text;
  628.          text_line : string[80];
  629.          achar     : char;
  630. begin
  631.    assign(text_file,'PASCAL.SRC');
  632.    reset(text_file);
  633.    while not eof(text_file) do
  634.      begin
  635.        readln(text_file,text_line);
  636.        writeln(text_line);
  637.      end;
  638.    close(text_file);
  639. end.
  640. . 8.   Compiler Directives 
  641.     - Source code embedded form : {$option+} or {$opttion-}
  642.                                   {$option info-string}
  643.     - Command-line Reference form : TPC [/$opt1/$opt2.../$optn] FILENAME
  644.     - Switch Directive : Turn compiler features by specifying + or - after the 
  645.                          directive name. The following are the default
  646.       A+      Align words and typed constants for non-8088 CPU
  647.       B-      Disable complete Boolean Evaluation
  648.       D+      Enable the generation of debug information
  649.       E+      Enable the linking with 8087 emulator
  650.       F-      Disable using the FAR call for all procedures or functions calling
  651.       I+      Generate I/O error checking for each I/O operation
  652.       L+      Enable the generation of local symbol information
  653.       N-      Do not generate the code to do real-time calculation by calling
  654.               run-time library routine
  655.       O-      Disable overlay code generation
  656.       R-      Disable the generation of range-checking code
  657.       S+      Enable the generation of stack-overflow checking code
  658.       V+      Perform type-checking on strings passed as variable parameters
  659.   - Parameter Directives : 
  660.       -- Source code embedded form
  661.            I filename   Include file
  662.            L filename   Link with named file
  663.            M stacksize,heapmin,heapmax  Specifies stack size,minimum and 
  664.                           maximum ofthe heap. Default is (16384,0,655360)
  665.            O unitname   Make a unit into an overlay
  666.       -- Command-line Reference form : TPC FILENAME [/opta/optb.../opt?]
  667.            B            Build
  668.            Ddefines     Conditional Defines
  669.            E            EXE & TPU Directory
  670.            Fseg:ofs     Find Error
  671.            GS           Segments Map File
  672.            GP           Publics Map File
  673.            GD           Detailed Map File
  674.            Ipath        Include Directories
  675.            L            Link Buffer
  676.            M            Make
  677.            Opath        Object Directories
  678.            Q            Suppress printing names,line numbers during compilation
  679.            Tpath        Turbo Directory
  680.            Upath        Unit Directories
  681.            V            Stand-alone Debugging
  682.   - Conditional Directives : only source code embedded form
  683.     {$DEFINE name}
  684.     {$UNDEF name}
  685.     {$IFDEF name}
  686.     {$IFNDEF name}
  687.     {$IFOPT switch}
  688.     {$ELSE}
  689.